import cv2

image = cv2.imread('sobel.png',cv2.IMREAD_GRAYSCALE)
Sobelx = cv2.Sobel(image,cv2.CV_64F,1,0)
Sobely = cv2.Sobel(image,cv2.CV_64F,1,0)
grad_x=cv2.convertScaleAbs(Sobelx)
grad_y = cv2.convertScaleAbs(Sobelx)
Sobelxy = cv2.addWeighted(grad_x,0.5,grad_y,0.5,0)
cv2.imshow('Input',image)
cv2.imshow('Sobel_x',Sobelx)
cv2.imshow('ScaleAbs_x',grad_x)
cv2.imshow('Sobel_y',Sobely)
cv2.imshow('ScaleAbs_y',grad_y)
cv2.imshow('Sobel',Sobelxy)
cv2.waitKey()
cv2.destroyAllWindows()